package pro30015_sinoss;

import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.sql.Connection;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class OracleConvert {

	/**
	 * 11g - 10g
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");
//		Connection srcConn = java.sql.DriverManager.getConnection("dbc:oracle:thin:@192.168.0.106:1521:orcl", "pro30015_reviews", "eplugger_reviews");
		Connection tarConn = java.sql.DriverManager.getConnection("dbc:oracle:thin:@172.16.1.3:1521:orcl", "pro30015", "eplugger");
	    try {
//			DBInfo srcInfo = new DBInfo(srcConn, "PRO30015", DBName.Oracle);
			DBInfo tarInfo = new DBInfo(tarConn, "PRO30015", DBName.Oracle);
//			DBUtils.dbConvertA2B(srcInfo, tarInfo,false);
			
			FileOutputStream fos = new FileOutputStream("/Users/firefly/Desktop/meta.sql");
            OutputStreamWriter osw = new OutputStreamWriter(fos);
			DBUtils.expertInsertSQL(tarInfo, tarInfo.getDialect(), osw, new String[]{"t_unit"}, null, true);
		} finally{
//			srcConn.close();
			tarConn.close();
		}
	    
	}

}
